import sys
sys.path.insert(0, 'third_party')
sys.path.insert(0, '.')
from config import *
from common import *
from tracker import Tracker
from tracker_web_handler import TrackerWebHandler
defaults_map = { 'rpc_host':TRACKER_RPC_HOST,                  
                 'rpc_port':TRACKER_RPC_PORT,
                 'external_ip':TRACKER_EXTERNAL_IP,
                 'external_port':TRACKER_EXTERNAL_PORT}
def main():
    args = parse_opt(defaults_map)
    tracker = Tracker(**args)    
    web_server.set_root('tracker/static')
    web_server.listen(TRACKER_HTTP_PORT)
    web_server.register(tracker, TrackerWebHandler)    
    web_server.run()
if __name__ == '__main__':
    main()